package com.fxwater.biz.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fxwater.biz.domain.FxwUserStationRelaInfo;
import com.fxwater.biz.mapper.UserStationRelationMapper;
import com.fxwater.biz.service.IUserStationRelationService;
import com.fxwater.common.core.text.Convert;

@Service
public class UserStationRelationService implements IUserStationRelationService {
	
	@Autowired
	private UserStationRelationMapper userStationRelationMapper;
	

	@Override
	public List<FxwUserStationRelaInfo> selectFxwUserStationRelaInfoList(
			FxwUserStationRelaInfo fxwUserStationRelaInfo) {
		return userStationRelationMapper.selectFxwUserStationRelaInfoList(fxwUserStationRelaInfo);
	}


	@Override
	public int removeStationUserRela(String ids) {
		return userStationRelationMapper.removeStationUserRela(Convert.toStrArray(ids));
	}


	@Override
	public int editSaveStationUserRela(FxwUserStationRelaInfo fxwUserStationRelaInfo) {
		// TODO Auto-generated method stub
//		fxwUserStationRelaInfo.setUpdateBy(ShiroUtils.getLoginName());
		return userStationRelationMapper.editSaveStationUserRela(fxwUserStationRelaInfo);
	}


	@Override
	public List<FxwUserStationRelaInfo> selectFxwUserStationRelaInfoSetList(
			FxwUserStationRelaInfo fxwUserStationRelaInfo) {
		return userStationRelationMapper.selectFxwUserStationRelaInfoSetList(fxwUserStationRelaInfo);
	}


	@Override
	public int saveStationUserRela(FxwUserStationRelaInfo fxwUserStationRelaInfo) {
//		fxwUserStationRelaInfo.setCreateBy(ShiroUtils.getLoginName());
		return userStationRelationMapper.saveStationUserRela(fxwUserStationRelaInfo);
	}


	@Override
	public int bindStationUsers(String stationId, String userIds) {
		String [] id = userIds.split(",");
		for(String userId : id) {
//            userStationRelationMapper.bindStationUsers(stationId,userId,ShiroUtils.getLoginName());
            userStationRelationMapper.bindStationUsers(stationId,userId,"");
		}
		return 0;
	}

}
